package java180.l_test;

import java.net.*;

class InetAddressTest {
	public static void main(String args[]) throws UnknownHostException {
		InetAddress inet=InetAddress.getLocalHost();
		System.out.println(inet.getHostAddress());
		System.out.println(inet.getHostName());
		System.out.println(inet);
		InetAddress inetsina=InetAddress.getByName("www.sina.com.cn");
		System.out.println(inetsina);
		System.out.println("IP:"+inetsina.getHostAddress());
		InetAddress[] inetbai=InetAddress.getAllByName("www.baidu.com");
		for (int i = 0; i < inetbai.length; i++) {
			System.out.println(inetbai[i]);
			System.out.println("baiIP:"+inetbai[i].getHostAddress());
		}
	}
}
